<template>
  <div>
    <m-head title="我的推广码"></m-head>
    <div class="ewm">
      <img :src="qrSrc" alt="">
      <p>扫一扫上面的二维码，加入我的团队</p>
    </div>
  </div>
</template>

<script>
import MHead from './MHeader'
import store from '../utils/store'

var qrcode = require('qrcode')
export default {
  name: 'generalization-code',
  components: {
    'm-head': MHead
  },
  data () {
    return {
      qrSrc: ''
    }
  },
  mounted () {
    let that = this
    qrcode.toDataURL('http://www.niceleads.cn?referId=' + store.getters.getUserInfo.id, {errorCorrectionLevel: 'H'}, function (err, url) {
      console.log(url)
      that.qrSrc = url
    })
  },
}
</script>

<style scoped>
  .ewm {
    width: 7rem;
    margin: 1.5rem auto;
    padding: .4rem;
    border: 1px solid #eee;
    text-align: center;
  }

  .ewm p {
    font-size: .34rem;
  }
</style>
